<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <title>选择支付方式</title>
    <meta content="" name="keywords">
    <meta content="" name="description">
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <!-- Set render engine for 360 browser -->
    <meta content="webkit" name="renderer">
    <!-- No Baidu Siteapp-->
    <meta content="no-siteapp" http-equiv="Cache-Control">
    <!-- Add to homescreen for Chrome on Android -->
    <meta content="yes" name="mobile-web-app-capable">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/amazeui/css/amazeui.min.css">
</head>

<body>
    <header data-am-widget="header" class="am-header am-header-default">
        <div class="am-header-left am-header-nav">
            <a href="#" class="" onclick="alert('请选择支付方式~');">
                <i class="am-header-icon am-icon-angle-left am-text-default"></i>
                <span class="am-header-nav-title">
                &nbsp;
              </span>
            </a>
        </div>
        <h1 class="am-header-title">
         请选择支付方式
      </h1>
    </header>
    <form class="am-form" id='form-with-tooltip' method='post'>
    <table class="am-table publicb">
        <thead>
            <tr>
                <th>支付方式</th>
            </tr>
        </thead>
        <tbody>
        <tr>
          <td>
 <div class="am-form-group">
      <label for="doc-ds-ipt-1">请输入支付金额</label>
      <input type="number" id="doc-ds-ipt-1" class="am-form-field" placeholder="请入支付金额" name='money' minlength="1" value="5" required />
    </div>
          </td>
        </tr>

            <tr>
                <td>
                 <label style='width:100%'>
                    <input type="radio" name="payType" value="weixinpay" checked>&nbsp;<img src="__PUBLIC__/Home/Img/wx.png" width="30">&nbsp;微信支付</label></td>
            </tr>
            <tr>
                <td>
                 <label style='width:100%'>
                    <input type="radio" name="payType" value="alipay">&nbsp;<img src="__PUBLIC__/Home/Img/zfb.png" width="30">&nbsp;支付宝支付
                    </label></td>
            </tr>
        </tbody>
    </table>
      <div class='am-g'>
        <div class='am-u-sm-12'>
        <if condition="$static">
            <button type="submit" class="am-btn am-btn-danger am-btn-block" disabled="disabled">{$static}</button>
            <else/>
             <button type="submit" class="am-btn am-btn-danger am-btn-block">下一步</button>
        </if>
        </div>
    </div>
    </form>

    <script charset="utf-8" src="__PUBLIC__/Jquery/jquery.min.js"></script>
    <script type="text/javascript">
    $(function(){
        var weixinpay="{:U('Code/weixinpay',array('id'=>$_GET['id']))}";
        var setmoney="{:U('Code/setmoney',array('id'=>$_GET['id']))}";
        var money=$("input[name='money']");
        $("button[type='submit']").click(function(){
            var payType=$("input[name='payType']:checked").val();
            if (money.val().length==0 || !money.val()) {
                alert('支付金额必须填写〜');
                return false;
            }else{
                // money.val()
                if (payType=='weixinpay') {
                    if (!money.val()) {
                        alert('支付金额必须填写');
                        return false;
                    };
                    getUrlPath(setmoney,money.val(),weixinpay);
                    return false;
                };
                if (payType=='alipay') {
                    alert('支付宝支付暂未开通!');
                    return false;
                };
            }
        });
        //
        function getUrlPath(setmoney,money,weixinpay){
            $.ajax({
               type: "POST",
               url: setmoney,
               data: "money="+money,
               success: function(msg){
                  window.location.href=weixinpay;
               },
               // error:function(msg){
               //  alert('网络连接失败〜');
               // }
            });
        }
    });
    </script>
</body>

</html>
